/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package tests;

/**
 *
 * @author luis
 */
public class ArrayVariable {
    int [] array;
    ArrayVariable(){
        int a;
        System.out.println("Introduce el valor del array:");
        a = Scan.Console.nextInt();
        array = new int[a];
        for (int i = 0; i < a; i++) {
            System.out.println("Introduce nmero: " + i);
            array[i] = Scan.Console.nextInt();
            //System.out.println(array[i]);
        }
    }

    /**
     *
     * @return
     */
    public int Suma(){
        int sum = 0;
        for (int i : array) {
            sum += i;
        }
        return sum;
    }

    /**
     *
     * @param args
     */
    public static void main(String[] args) {
        ArrayVariable array1 = new ArrayVariable();
        System.out.println("Suma: " + array1.Suma());
    }
}
